home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
pcmagdoc.arc
/
PUSHDIR.DOC
< prev
next >
Wrap
Text File
|
1988-01-19
|
3KB
|
61 lines
PUSHDIR (and POPDIR) John Friend
Commands PC Magazine Vol 5, No 10
Copyright 1986 Ziff-Davis Publishing Company
______________________________________________________
Purpose: Provides a way to return automatically to
your current directory after running programs
that require directory changing.
Format: PUSHDIR
[CD \AltDir\ProgName]
POPDIR
Remarks: While PUSHDIR and POPDIR can be entered
directly from the DOS prompt, their primary
application is in batch files. For example,
suppose you create a file named 12.BAT that
consists of the following four lines:
PUSHDIR
CD\LOTUS
123
POPDIR
Suppose also that 12.BAT, PUSHDIR.COM, and
POPDIR.COM are either in your root directory
or in a subdirectory on the PATH specified in
your AUTOEXEC.BAT file. Assume, finally,
that you are currently in your word
processing subdirectory (\WP), but need some
information from a 1-2-3 spreadsheet. If you
now enter
12<CR>
from the DOS prompt, PUSHDIR stores the \WP
(your current directory) on its stack and DOS
changes to the \LOTUS subdirectory and runs
1-2-3. When you exit from 1-2-3, you would
normally be left in the \LOTUS subdirectory.
A DOS CD command in 12.BAT after the 123 line
could return you to a specified directory
every time you terminated 1-2-3, of course.
But POPDIR returns you to whatever
subdirectory you were in when you invoked 1-
2-3--in this case, to your \WP subdirectory.
PUSHDIR can accommodate up to six levels of
directories on its stack, permitting
considerable programming flexibility in
constructing batch files.
Notes:
1. PUSHDIR and POPDIR require DOS 2.0 or
later.